<?php

use Phinx\Migration\AbstractMigration;
use Phinx\Db\Adapter\MysqlAdapter;
class WithdrawCardInfo extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {
        $table = $this->table('withdraw_card_info',array('comment' => '会员提现所用卡的信息'));
        $table->addColumn('user_id', 'integer', array('comment' => '会员id'))
			  ->addColumn('bank_num', 'string', array('limit' => 255,'default' => '', 'comment' => '银行卡号'))
			  ->addColumn('open_bank', 'string', array('limit' => 255,'default' => '', 'comment' => '开户行'))
              ->addColumn('created_at', 'timestamp', array('default' => 'CURRENT_TIMESTAMP'))
              ->addColumn('updated_at', 'timestamp', array('null' => true))
              ->addIndex('id')
              ->addIndex('user_id')
              ->save();   
    }
    public function down()
    {
        $this->dropTable('withdraw_card_info');
    }
}
